package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
           //负责：将写出的字节写入到文件中
        FileOutputStream fos = new FileOutputStream("pw2.txt");
           //负责：将写出的字符全部转换为字节(可以按照指定的字符集转换)
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
            //负责：块写文本数据(攒够8192个字符一次性写出)
        BufferedWriter bw = new BufferedWriter(osw);
            //负责：按行写出字符
        PrintWriter pw = new PrintWriter(bw);
        pw.println("门前大桥下");
        pw.println("游过一群鸭");
        pw.close();
    }
}
